package demo1;

/**
 * 数组中的每个元素都是引用数据类型的对象，将数组中的每个元素打印出来
 */
import java.util.Arrays;
class Student{
    public String name;
    public int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
public class Test {

    public static void main(String[] args) {
        Student[] students = {
                new Student("zhangsan",18),
                new Student("lisi",20)
        };
        System.out.println(Arrays.toString(students));
    }

}
